define(['jquery', 'text!../../Content/discussions/discussions.html', 'common', 'knockout'], function($, html, common, ko){

	var container;

	function init(c){
		container = $(c);
		container.html(html);
		loadTeamNav();

		$(container).on('click', '.listDoc', function(e) {
			e.preventDefault();
			$(this).siblings('ul.open').removeClass('open');
			var $commentsUl = $(this).toggleClass('open').next('div');
			$commentsUl.toggleClass("hide").siblings('div:not(.hide)').addClass('hide');
		});
	}

	var viewModel = {
		Discussions : ko.observable()
	};

	function loadTeamNav(){
		common.service('discussions.json').success(function(data){
			viewModel.Discussions = data;
			ko.applyBindings(viewModel, container[0]);
		});
	}


	return {
		"init" : init
	};


});